package com.pzl.text;

import com.pzl.domain.User;
import com.pzl.service.UserService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import javax.sound.midi.SoundbankResource;
import javax.swing.*;
import java.util.List;

/**
 * UserText class
 *
 * @Author panzhenglei
 * @Date 2019/6/14 7:21 PM
 */

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:applicationContext.xml"})
public class UserText {

    @Autowired
    private UserService userService;

    @Test
    public void textFindAll(){

        List<User> users = userService.findAll();

        System.out.println(users);

    }


    @Test
    public void textFindById(){

        User user = userService.findByID(1);

        System.out.println(user);

    }

    @Test
    public void textUpdate(){

        User user = userService.findByID(1);

        System.out.println(user);

        user.setAge(22);

        userService.update(user);

        user = userService.findByID(1);

        System.out.println(user);
    }


}



